package com.graduation.cdm.funactivity.view.fragment;

import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.google.gson.Gson;
import com.graduation.cdm.funactivity.MyApplication;
import com.graduation.cdm.funactivity.R;
import com.graduation.cdm.funactivity.bean.ActivityBean;
import com.graduation.cdm.funactivity.bean.DomainBean;
import com.graduation.cdm.funactivity.dialog.ThreeMenuDialog;
import com.graduation.cdm.funactivity.util.CommonAdapter;
import com.graduation.cdm.funactivity.util.ResUtil;
import com.graduation.cdm.funactivity.util.ViewHolder;
import com.graduation.cdm.funactivity.util.WheelDialogFragment;
import com.graduation.cdm.funactivity.view.PublishActivity;
import com.graduation.cdm.funactivity.view.activityview.HomeAllActivity;
import com.graduation.cdm.funactivity.view.activityview.WeatherActivity;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
import com.ramotion.foldingcell.FoldingCell;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;

import static android.content.Context.MODE_PRIVATE;
import static com.graduation.cdm.funactivity.util.DateUtils.longToDatestring;
import static com.graduation.cdm.funactivity.util.GlobalConstant.preUrl;
import static com.graduation.cdm.funactivity.util.getUtils.getUser;
import static com.graduation.cdm.funactivity.util.xUtilsImageUtils.display;
import static com.graduation.cdm.funactivity.util.xUtilsImageUtils.displayActFrag;

/**
 * Created by cdm on 2017/3/1.
 */

public class ActivityFragment extends Fragment implements View.OnClickListener {

    Map<String,String> region = new HashMap<String,String>();
    Map<String,String> map_category = new HashMap<String,String>();
    private boolean flag = false;

    private View view_activityFragment;

    private Animation rotate_anticlockwise, rotate_clockwise, scale_max,
            scale_min, alpha_button;

    private RelativeLayout plus_rl;
    private RelativeLayout rl_plus;
    private ImageView plus_im;
    private TextView address_select;
    private TextView tv_address_select;
    private TextView tv_address;
    private TextView dishui_tv,publish_tv;
    private TextView service_category;
    private RadioGroup rg_choice;
    private RadioButton publish;
    private RadioButton join;
    private ViewPager vp_service;

    private LayoutInflater inflater;
    private List<View> viewList = new ArrayList<View>();

    private PullToRefreshListView plv_1;
    private PullToRefreshListView plv_2;
    private int page =1;
    private int pageCount=1;
    private HashSet<Integer> unfoldedIndexes = new HashSet<>();
    private boolean pageSelecter=true;
    private boolean refreshFlag =false;
    private List<ActivityBean.Activity> activityList = new ArrayList<>();
    private CommonAdapter<ActivityBean.Activity> activityCommonAdapter;
    private ListView publishListView;
    private ListView joinListView;

    private String category_id="";
    private String region_id="";
    private boolean clicked = false;// 记录加号按钮的点击状态，默认为没有点击

    private String activityCity;
    private String activityLabel;
    private String stateId;
    Integer userId;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        view_activityFragment = inflater.inflate(R.layout.fragment_activity,container,false);

        initData();
        initMap();
        initView();

        return view_activityFragment;
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode==1&&resultCode==100){
            page=1;
            activityList.clear();
            getPublishList(2);
        }
        if (requestCode==2&&resultCode==200){
            page=1;
            activityList.clear();
            getPublishList(1);
        }
    }

    private void initMap(){
        region.put("不限","0");
        region.put("未开始","1");
        region.put("进行中","2");
        region.put("已结束","3");
    }

    private void initData(){
        SharedPreferences sharedPreferences = getActivity().getSharedPreferences("user_info", MODE_PRIVATE);
        userId = sharedPreferences.getInt("userId",0);
        rotate_anticlockwise = AnimationUtils.loadAnimation(getContext(),R.anim.rotate_anticlockwise);
        rotate_clockwise = AnimationUtils.loadAnimation(getContext(),R.anim.rotate_clockwise);
        scale_max = AnimationUtils.loadAnimation(getContext(), R.anim.scale_max);
        scale_min = AnimationUtils.loadAnimation(getContext(), R.anim.scale_min);
        alpha_button = AnimationUtils.loadAnimation(getContext(), R.anim.alpha_button);

        plus_rl = (RelativeLayout) view_activityFragment.findViewById(R.id.plus_rl);
        rl_plus = ((RelativeLayout) view_activityFragment.findViewById(R.id.rl_plus));
        plus_im = (ImageView) view_activityFragment.findViewById(R.id.plus_im);
        dishui_tv = (TextView) view_activityFragment.findViewById(R.id.dishui_tv);
        publish_tv = (TextView) view_activityFragment.findViewById(R.id.publish_tv);
        service_category = ((TextView) view_activityFragment.findViewById(R.id.service_category));
        publish = ((RadioButton) view_activityFragment.findViewById(R.id.publish));
        join = ((RadioButton) view_activityFragment.findViewById(R.id.join));
        rg_choice = ((RadioGroup) view_activityFragment.findViewById(R.id.rg_choice));
        vp_service = ((ViewPager) view_activityFragment.findViewById(R.id.vp_service));
        address_select = ((TextView) view_activityFragment.findViewById(R.id.address_select));
        tv_address_select = ((TextView) view_activityFragment.findViewById(R.id.tv_address_select));
        tv_address = ((TextView) view_activityFragment.findViewById(R.id.tv_address));

        address_select.setOnClickListener(this);
        tv_address_select.setOnClickListener(this);
        service_category.setOnClickListener(this);
        tv_address.setOnClickListener(this);
        rl_plus.setOnClickListener(this);
        dishui_tv.setOnClickListener(this);
        publish_tv.setOnClickListener(this);
    }

    private void initView(){
        //System.out.println("=====initView==============="+activityList);
        inflater = LayoutInflater.from(getContext());

        View view1 = inflater.inflate(R.layout.activity_publish_layout, null);
        View view2 = inflater.inflate(R.layout.activity_join_layout, null);
        viewList.add(view1);
        viewList.add(view2);
        plv_1 = ((PullToRefreshListView) view1.findViewById(R.id.lv_publish));
        plv_2 = ((PullToRefreshListView) view2.findViewById(R.id.lv_join));

        vp_service.setAdapter(new PagerAdapter() {
            @Override
            public int getCount() {
                //System.out.println("=====getCount==============="+viewList.size());
                return viewList.size();
            }

            @Override
            public boolean isViewFromObject(View view, Object object) {
                //System.out.println("=====isViewFromObject==============="+view == object);
                return view == object;
            }

            @Override
            public Object instantiateItem(ViewGroup container, int position) {
                container.addView(viewList.get(position));
                //System.out.println("=====instantiateItem==============="+viewList.get(position));
                return viewList.get(position);
            }

            @Override
            public void destroyItem(ViewGroup container, int position, Object object) {
                //System.out.println("=====destroyItem===============");
                container.removeView(viewList.get(position));
            }
        });
        vp_service.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
                //System.out.println("=====onPageScrolled===============");
            }

            @Override
            public void onPageSelected(int position) {
                System.out.println("=====onPageSelected==============="+activityList);
                unfoldedIndexes.clear();
                page =1;
                if (position == 0){
                    publish.setChecked(true);
                    pageSelecter=true;
                    publishPullToRefresh();

                }else {
                    join.setChecked(true);
                    pageSelecter=false;
                    joinPullToRefresh();
                }
            }

            @Override
            public void onPageScrollStateChanged(int state) {
                //System.out.println("=====onPageScrollStateChanged===============");
            }
        });
        rg_choice.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                if (checkedId == R.id.publish) {
                    //System.out.println("=====onCheckedChanged===============publish");
                    vp_service.setCurrentItem(0);
                } else {
                    //System.out.println("=====onCheckedChanged===============join");
                    vp_service.setCurrentItem(1);
                }
            }
        });
        publishPullToRefresh();
    }

    private void publishPullToRefresh() {
        plv_1.setScrollingWhileRefreshingEnabled(true);
        plv_1.setMode(PullToRefreshBase.Mode.BOTH);
        plv_1.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ListView>() {
            @Override
            public void onRefresh(PullToRefreshBase<ListView> refreshView) {
                PullToRefreshBase.Mode mode = plv_1.getCurrentMode();
                if(mode == PullToRefreshBase.Mode.PULL_FROM_START){
                    refreshFlag=true;
                    page =1;
                    getPublishList(2);

                }else if(mode==PullToRefreshBase.Mode.PULL_FROM_END){
                    page++;
                    getPublishList(2);

                }
            }
        });

        plv_1.setOnLastItemVisibleListener(new PullToRefreshBase.OnLastItemVisibleListener() {
            @Override
            public void onLastItemVisible() {

            }
        });
        publishListView = plv_1.getRefreshableView();

        publishListView.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                return flag;
            }
        });
        System.out.println("======activityCommonAdapter============"+activityList);
        activityCommonAdapter = new CommonAdapter<ActivityBean.Activity>(getContext(),activityList,R.layout.cell) {
            @Override
            public void convert(ViewHolder viewHolder, ActivityBean.Activity activity, final int position) {
                final FoldingCell fc = viewHolder.getViewById(R.id.folding_cell);

                fc.setOnLongClickListener(new View.OnLongClickListener() {
                    @Override
                    public boolean onLongClick(View v) {
                        Intent intent = new Intent(getActivity(), HomeAllActivity.class);
                        Bundle bundle = new Bundle();
                        bundle.putSerializable("activityInfo",activityList.get(position));
                        //System.out.println("============"+activityList.get(position));
                        intent.putExtras(bundle);
                        startActivityForResult(intent,1);
                        return false;
                    }
                });

                // attach click listener to folding cell
                fc.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        fc.toggle(false);

                        flag=true;

                        Handler x = new Handler();
                        x.postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                flag=false;
                            }
                        }, 1000);

                        if (unfoldedIndexes.contains(position))
                            registerFold(position);
                        else
                            registerUnfold(position);
                    }
                });

                /*if (unfoldedIndexes.contains(position)) {
                    fc.unfold(true);
                } else {
                    fc.fold(true);
                }*/

                TextView service_province= viewHolder.getViewById(R.id.service_province);
                TextView service_city= viewHolder.getViewById(R.id.service_city);
                TextView title_date=viewHolder.getViewById(R.id.title_date);
                TextView title_category=viewHolder.getViewById(R.id.title_category);
                TextView title_title=  viewHolder.getViewById(R.id.title_title);
                TextView title_status=  viewHolder.getViewById(R.id.title_status);
                TextView title_maxpeople=viewHolder.getViewById(R.id.title_maxpeople);

                TextView content_category=viewHolder.getViewById(R.id.content_category);
                TextView content_service_type=viewHolder.getViewById(R.id.content_service_type);
                ImageView conntent_fm=viewHolder.getViewById(R.id.head_image);

                ImageView content_userhead=viewHolder.getViewById(R.id.content_userhead);
                TextView content_name= viewHolder.getViewById(R.id.content_name);
                TextView content_content=viewHolder.getViewById(R.id.content_content);
                TextView content_mobile=viewHolder.getViewById(R.id.content_mobile);
                TextView content_add_time= viewHolder.getViewById(R.id.content_add_time);
                TextView content_address= viewHolder.getViewById(R.id.content_address);

                service_province.setText(activity.activityProvince.substring(0,2));
                service_city.setText(activity.activityCity);
                title_date.setText(longToDatestring(activity.activityCreattime));
                title_category.setText("【"+activity.activityLabel+"】");
                title_title.setText(activity.activityTheme);
                title_status.setText(1==activity.stateId?"未开始":(2==activity.stateId?"进行中":"已完成"));
                title_maxpeople.setText(activity.activityMaxPeopleNumber+"");

                content_category.setText(activity.activityLabel);
                content_service_type.setText(1==activity.stateId?"未开始":(2==activity.stateId?"进行中":"已完成"));
                content_content.setText(activity.activityDesc);
                content_add_time.setText(longToDatestring(activity.activityCreattime));
                content_address.setText(activity.activityAddress);
                //conntent_fm
                displayActFrag(conntent_fm,preUrl+activity.activityImgurl);

                getUser(activity,content_userhead,content_name,content_mobile);
            }
        };
        publishListView.setAdapter(activityCommonAdapter);
        getPublishList(2);
    }

    private void joinPullToRefresh() {
        plv_2.setScrollingWhileRefreshingEnabled(true);
        plv_2.setMode(PullToRefreshBase.Mode.BOTH);
        plv_2.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ListView>() {
            @Override
            public void onRefresh(PullToRefreshBase<ListView> refreshView) {
                PullToRefreshBase.Mode mode = plv_2.getCurrentMode();
                if(mode == PullToRefreshBase.Mode.PULL_FROM_START){
                    refreshFlag=true;
                    page =1;
                    getPublishList(1);
                }else if(mode==PullToRefreshBase.Mode.PULL_FROM_END){
                    page++;
                    getPublishList(1);

                }
            }
        });
        plv_2.setOnLastItemVisibleListener(new PullToRefreshBase.OnLastItemVisibleListener() {
            @Override
            public void onLastItemVisible() {

            }
        });
        joinListView = plv_2.getRefreshableView();
        joinListView.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                return flag;
            }
        });
        System.out.println("======activityCommonAdapter============"+activityList);
        activityCommonAdapter = new CommonAdapter<ActivityBean.Activity>(getContext(),activityList,R.layout.cell) {
            @Override
            public void convert(ViewHolder viewHolder, ActivityBean.Activity activity, final int position) {
                final FoldingCell fc = viewHolder.getViewById(R.id.folding_cell);

                fc.setOnLongClickListener(new View.OnLongClickListener() {
                    @Override
                    public boolean onLongClick(View v) {
                        Intent intent = new Intent(getActivity(), OperateJoinActivity.class);
                        Bundle bundle = new Bundle();
                        bundle.putSerializable("activityInfo",activityList.get(position));
                        //System.out.println("============"+activityList.get(position));
                        intent.putExtras(bundle);
                        startActivityForResult(intent,2);
                        return false;
                    }
                });

                // attach click listener to folding cell
                fc.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        fc.toggle(false);


                        flag=true;

                        Handler x = new Handler();
                        x.postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                flag=false;
                            }
                        }, 1000);

                        if (unfoldedIndexes.contains(position))
                            registerFold(position);
                        else
                            registerUnfold(position);
                    }
                });

                /*if (unfoldedIndexes.contains(position)) {
                    fc.unfold(true);
                } else {
                    fc.fold(true);
                }*/

                TextView service_province= viewHolder.getViewById(R.id.service_province);
                TextView service_city= viewHolder.getViewById(R.id.service_city);
                TextView title_date=viewHolder.getViewById(R.id.title_date);
                TextView title_category=viewHolder.getViewById(R.id.title_category);
                TextView title_title=  viewHolder.getViewById(R.id.title_title);
                TextView title_status=  viewHolder.getViewById(R.id.title_status);
                TextView title_maxpeople=viewHolder.getViewById(R.id.title_maxpeople);

                TextView content_category=viewHolder.getViewById(R.id.content_category);
                TextView content_service_type=viewHolder.getViewById(R.id.content_service_type);
                ImageView conntent_fm=viewHolder.getViewById(R.id.head_image);

                ImageView content_userhead=viewHolder.getViewById(R.id.content_userhead);
                TextView content_name= viewHolder.getViewById(R.id.content_name);
                TextView content_content=viewHolder.getViewById(R.id.content_content);
                TextView content_mobile=viewHolder.getViewById(R.id.content_mobile);
                TextView content_add_time= viewHolder.getViewById(R.id.content_add_time);
                TextView content_address= viewHolder.getViewById(R.id.content_address);


                service_province.setText(activity.activityProvince.substring(0,2));
                service_city.setText(activity.activityCity);
                title_date.setText(longToDatestring(activity.activityCreattime));
                title_category.setText("【"+activity.activityLabel+"】");
                title_title.setText(activity.activityTheme);
                title_status.setText(1==activity.stateId?"未开始":(2==activity.stateId?"进行中":"已完成"));
                title_maxpeople.setText(activity.activityMaxPeopleNumber+"");

                content_category.setText(activity.activityLabel);
                content_service_type.setText(1==activity.stateId?"未开始":(2==activity.stateId?"进行中":"已完成"));
                content_content.setText(activity.activityDesc);
                content_add_time.setText(longToDatestring(activity.activityCreattime));
                content_address.setText(activity.activityAddress);
                //conntent_fm
                display(conntent_fm,preUrl+activity.activityImgurl);

                getUser(activity,content_userhead,content_name,content_mobile);
            }
        };
        joinListView.setAdapter(activityCommonAdapter);
        getPublishList(1);
    }


    private void getPublishList(int type) {
        String url = null;
        final int activity_type=type;
        if (activity_type == 2) {
            url = preUrl + "activity/getByPublisher";
        }
        if (activity_type == 1){
            url = preUrl + "activity/getByJoiner";
        }
        StringRequest stringRequest = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() {
            @Override
            public void onResponse(String s) {
                System.out.println("onResponse==:"+s.trim());
                Gson gson = new Gson();
                ActivityBean activityBean = gson.fromJson(s,ActivityBean.class);
                pageCount = Integer.parseInt(activityBean.pageSum);
                if (activity_type == 2) {
                    if (page == 1) {
                        activityList.clear();
                    }
                    if (page <= pageCount) {
                        activityList.addAll(activityBean.activityList);
                    } else {
                        Toast.makeText(getActivity(), "已经是最后一页了", Toast.LENGTH_SHORT).show();
                    }
                    plv_1.onRefreshComplete();
                    System.out.println(activityList);
                    activityCommonAdapter.notifyDataSetChanged();
                }else {
                    if (page == 1) {
                        activityList.clear();
                    }
                    if (page <= pageCount) {
                        activityList.addAll(activityBean.activityList);
                    } else {
                        Toast.makeText(getActivity(), "已经是最后一页了", Toast.LENGTH_SHORT).show();
                    }
                    plv_2.onRefreshComplete();
                    System.out.println(activityList);
                    activityCommonAdapter.notifyDataSetChanged();
                }
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError volleyError) {
                System.out.println("Err="+volleyError.toString());
            }
        }){
            @Override
            protected Map<String, String> getParams() throws AuthFailureError {
                Map<String,String> map=new HashMap<>();
                map.put("pageNow",page+"");
                map.put("pageSize",4+"");
                map.put("userId",userId+"");
                if (activityCity!=null&&activityCity!="") {
                    if (activityCity.equals("不限")){
                        activityCity="";
                    }
                    map.put("activityCity", activityCity);
                }
                if (activityLabel!=null&&activityLabel!="") {
                    map.put("activityLabel", activityLabel);
                }
                if (stateId!=null&&stateId!="") {
                    if (stateId.equals("0")){
                        stateId = "";
                    }
                    map.put("stateId", stateId);
                }
                return map;
            }
        };
        MyApplication.getRequestQueue().add(stringRequest);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.service_category:
                up_choice_service();
                break;
            case R.id.address_select:
                up_choice_address();
                break;
            case R.id.tv_address_select:
                up_choice_address();
                break;
            case R.id.rl_plus:
                show_round();
                break;
            case R.id.publish_tv:
                v.startAnimation(alpha_button);
                rl_plus.performClick();
                Intent intent=new Intent(getActivity(),PublishActivity.class);
                startActivity(intent);
                break;
            case R.id.dishui_tv:
                Intent weather_intent = new Intent(getActivity(), WeatherActivity.class);
                startActivity(weather_intent);
                break;
        }
    }

    public void registerFold(int position) {
        unfoldedIndexes.remove(position);
    }

    public void registerUnfold(int position) {
        unfoldedIndexes.add(position);
    }

    public void up_choice_service() {
        final WheelDialogFragment wheelViewDialogFragment = WheelDialogFragment
                .newInstance(ResUtil.getStringArray(R.array.main_service_menu),
                        ResUtil.getString(R.string.app_cancel),
                        ResUtil.getString(R.string.app_sure), true, false, false);
        wheelViewDialogFragment.setWheelDialogListener(new WheelDialogFragment.OnWheelDialogListener() {
            @Override
            public void onClickLeft(String value) {
                wheelViewDialogFragment.dismiss();
            }

            @Override
            public void onClickRight(String value) {
                wheelViewDialogFragment.dismiss();
                page=1;
                service_category.setText(value);
                stateId=region.get(value);
                unfoldedIndexes.clear();
                System.out.println("category_id="+stateId);
                Log.i("flag",(pageSelecter?"需求":"服务"));
                if(pageSelecter)
                {
                    publishPullToRefresh();
                }else {
                    joinPullToRefresh();
                }
            }

            @Override
            public void onValueChanged(String value) {

            }
        });
        wheelViewDialogFragment.show(getFragmentManager(), "");
    }

    public void up_choice_address() {
        ThreeMenuDialog dialog=new ThreeMenuDialog(getContext());
        dialog.setonItemClickListener(new ThreeMenuDialog.MenuItemClickListener() {
            @Override
            public void onMenuItemClick(DomainBean.Domain domain) {
                if (domain!=null) {
                    address_select.setVisibility(View.GONE);
                    tv_address_select.setText(domain.domainText); //选中第三个菜单后，主页面的name设置为选中的name
                    activityCity = tv_address_select.getText().toString();
                    page = 1;
                    if(pageSelecter)
                    {
                        publishPullToRefresh();
                    }else {
                        joinPullToRefresh();
                    }
                }

            }
        });
        dialog.show();
    }

    public void show_round(){
        // TODO Auto-generated method stub
        clicked = !clicked;
        // 两个按钮的显示隐藏
        dishui_tv.setVisibility(clicked ? View.VISIBLE : View.GONE);
        publish_tv.setVisibility(clicked ? View.VISIBLE : View.GONE);
        // 加号旋转
        plus_im.startAnimation(clicked ? rotate_anticlockwise
                : rotate_clockwise);
        // 按钮显示隐藏效果
        dishui_tv.startAnimation(clicked ? scale_max : scale_min);
        publish_tv.startAnimation(clicked ? scale_max : scale_min);
        // 背景色的改变
        plus_rl.setBackgroundColor(clicked ? Color
                .parseColor("#99ffffff") : Color.TRANSPARENT);
        // 背景是否可点击，用于控制Framelayout层下面的视图是否可点击
        plus_rl.setClickable(clicked);
        dishui_tv.setClickable(clicked ?true :false);
        publish_tv.setClickable(clicked ?true :false);
    }


}
